<template>
  <div class="portrait_body">
    <div class="bgc">
      <div class="content">
        <div class="ep-name">
          <img
            class="search_icon"
            src="~@img/portrait/icon-search.png"
            alt=""
          />
          <el-input
            placeholder="请输入企业名称"
            v-model="company"
            @keyup.enter.native="search"
          >
          </el-input>
          <span class="search_input" @click="search">搜索</span>
        </div>
        <ul class="option ">
          <li>
            <label for="">企业类型 :</label>
            <el-select v-model="entypeid" clearable placeholder="请选择">
              <el-option
                v-for="item in options_type"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li>
            <label for="">企业资质 :</label>
            <el-select v-model="qualificat" clearable placeholder="请选择">
              <el-option
                v-for="item in options_qualificat"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li>
            <label for="">注册资本 :</label>
            <el-select v-model="capital_id" clearable placeholder="请选择">
              <el-option
                v-for="item in options_capital"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li>
            <label for="">上市状态 :</label>
            <el-select v-model="public_id" clearable placeholder="请选择">
              <el-option
                v-for="item in options_quoted"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li>
            <label for="">所在地区 :</label>
            <el-cascader
              v-model="area"
              :options="options_area"
              :props="{
                label: 'label',
                value: 'value',
                children: 'children',
                checkStrictly: true,
              }"
              :clearable="true"
            ></el-cascader>
          </li>
          <li>
            <label for="">成立时间 :</label>
            <el-select v-model="yearid" clearable placeholder="请选择">
              <el-option
                v-for="item in options_build"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li>
            <label for="">融资轮次 :</label>
            <el-select v-model="financ_id" clearable placeholder="请选择">
              <el-option
                v-for="item in options_financ"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </li>
          <li>
            <el-button style="cursor:default;" @click="search">查询</el-button>
            <el-button style="cursor:default;" @click="clear">清空</el-button>
          </li>
        </ul>
      </div>
    </div>
    <div class="portrait_main content">
      <div class="table_box_padding content">
        <div class="size">
          <img src="~@img/portrait/icon-result.png" alt="" />
          已为您{{ total }}家找到相关企业
        </div>
        <el-table
          :data="enterpriseData"
          border
          stripe
          v-loading="loading"
          style="width: 100%"
          :height="392"
          tooltip-effect="light"
          :header-cell-style="{
            textAlign: 'center',
          }"
          :cell-style="{
            textAlign: 'center',
          }"
        >
          <!-- <el-table-column :show-overflow-tooltip="true" label="企业名称">
            <template slot-scope="scope">
              <div
                @click="goEnterprise(scope.row.id)"
                style="cursor: pointer;"
                v-html="scope.row.company"
              ></div>
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="industry"
            label="所属行业"
          >
            <template slot-scope="scope">
              <div v-html="scope.row.industry"></div>
            </template>
          </el-table-column>

          <el-table-column
            :show-overflow-tooltip="true"
            prop="product"
            label="主营产品"
          >
            <template slot-scope="scope">
              <div v-html="scope.row.product"></div>
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="createtime"
            label="成立日期"
            width="110px"
          >
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="money"
            label="注册资本/万元"
          >
          </el-table-column> -->
          <el-table-column
            :show-overflow-tooltip="true"
            prop="index"
            label="序号"
          >
            <template slot-scope="scope">
              {{ scope.row.index + per_page * (page - 1) }}
            </template>
          </el-table-column>
          <el-table-column :show-overflow-tooltip="true" label="企业名称">
            <template slot-scope="scope">
              <div
                @click="goEnterprise(scope.row.id)"
                style="cursor: pointer;"
                v-html="scope.row.company"
              ></div>
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="area"
            label="所属地区"
          >
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="createtime"
            label="成立日期"
            width="110px"
          >
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="legal"
            label="法人"
            width="80px"
          >
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="money"
            label="注册资本/万元"
          >
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="entype"
            label="企业类型"
          >
          </el-table-column>

          <el-table-column
            :show-overflow-tooltip="true"
            prop="enterpriseQualification"
            label="企业资质"
          >
            <template slot-scope="scope">
              <div>
                <el-tag v-if="scope.row.isfive" style="margin-right:5px;">
                  {{ scope.row.isfive }}
                </el-tag>
                <el-tag
                  v-if="scope.row.quoted_company"
                  style="margin-right:5px;"
                >
                  {{ scope.row.quoted_company }}
                </el-tag>
                <el-tag v-if="scope.row.chain_master" style="margin-right:5px;">
                  {{ scope.row.chain_master }}
                </el-tag>
                <el-tag v-if="scope.row.unicorn" style="margin-right:5px;">
                  {{ scope.row.unicorn }}
                </el-tag>
                <el-tag v-if="scope.row.high_new" style="margin-right:5px;">
                  {{ scope.row.high_new }}
                </el-tag>
                <el-tag v-if="scope.row.dengl" style="margin-right:5px;">
                  {{ scope.row.dengl }}
                </el-tag>
                <el-tag v-if="scope.row.scale" style="margin-right:5px;">
                  {{ scope.row.scale }}
                </el-tag>
                <el-tag v-if="scope.row.zjtg" style="margin-right:5px;">
                  {{ scope.row.zjtg }}
                </el-tag>
                <el-tag v-if="scope.row.tbe" style="margin-right:5px;">
                  {{ scope.row.tbe }}
                </el-tag>
                <el-tag v-if="scope.row.fianacing" style="margin-right:5px;">
                  {{ scope.row.fianacing }}
                </el-tag>
                <el-tag v-if="scope.row.patent" style="margin-right:5px;">
                  {{ scope.row.patent }}
                </el-tag>
              </div>
            </template>
          </el-table-column>
          <el-table-column
            :show-overflow-tooltip="true"
            prop="address"
            label="地址"
          ></el-table-column>
          <el-table-column :show-overflow-tooltip="true" label="联系方式">
            <template slot-scope="scope">
              {{ scope.row.telephone }}
              <i
                v-if="scope.row.telephone"
                @click="$copy(scope.row.telephone)"
                class="el-icon-copy-document"
                style="cursor: pointer;"
              ></i>
            </template>
          </el-table-column>
        </el-table>
        <div class="pagination">
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="page"
            :page-size="per_page"
            :page-sizes="[7, 10, 15, 20]"
            layout=" prev, pager, next,  sizes, jumper"
            :total="total"
          >
          </el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapData } from "../radar/page/mapData";
import { field, getRegion, search360 } from "@api/portrait";
export default {
  data() {
    return {
      activeName: "enterprise",
      enterpriseData: [],
      currentPage: 1,

      options_build: [],
      options_capital: [],
      options_financ: [],
      options_industry: [],
      options_quoted: [],
      options_scale: [],
      options_status: [],
      options_type: [],
      options_qualificat: [],
      options_area: mapData,

      company: "", //企业名称
      industry: "", // 所属行业
      qualificat: "", //资质id
      capital_id: "", //注册资本
      public_id: "", //上市状态
      area: "", //所属地区
      yearid: "", // 成立年限
      financ_id: "", //融资轮次
      status: "", //企业状态
      scale_range: "", //企业规模
      entypeid: "", //企业类型
      page: 1, // 页码
      per_page: 7, // 每页的条数
      total: 0, // 每页的条数
      loading: false,
      selectOptions: {
        company: "",
        qualificat: "",
        capital_id: "",
        public_id: "",
        area: ["", "", ""],
        yearid: "",
        financ_id: "",
        entypeid: "",
        page: 1, // 页码
        per_page: 7,
      },
    };
  },
  mounted() {
    this.getField();
    // this.getRegion();
    this.search360();
  },
  methods: {
    async getField() {
      let res = await field();
      if (res.code == 0) {
        this.options_build = res.options.buildate;
        this.options_capital = res.options.capital;
        this.options_financ = res.options.financ;
        this.options_quoted = res.options.quoted;
        this.options_type = res.options.entype;

        // this.options_qualificat = res.options.qualificat;
        this.options_qualificat = [
          {
            label: "中国500强企业",
            value: 4,
          },
          {
            label: "上市企业",
            value: 3,
          },
          {
            label: "高新技术企业",
            value: 1,
          },
          {
            label: "独角兽企业",
            value: 5,
          },
          {
            label: "瞪羚企业",
            value: 6,
          },
          {
            label: "科技型中小企业",
            value: 2,
          },
        ];
      }
    },
    async getRegion() {
      let res = await getRegion();
      this.options_area = res;
    },
    async search360() {
      let res = await search360(this.selectOptions);
      this.loading = false;
      this.enterpriseData = res.data.map((item, index) => {
        item.index = index + 1;
        return item;
      });
      this.total = res.size;
    },

    async search() {
      // 点击搜索更改
      this.page = 1;
      this.loading = true;
      let area = [...this.area, "", "", ""];
      this.selectOptions = {
        company: this.company,
        qualificat: this.qualificat,
        capital_id: this.capital_id,
        public_id: this.public_id,
        area: area,
        yearid: this.yearid,
        financ_id: this.financ_id,
        entypeid: this.entypeid,
        page: this.page, // 页码
        per_page: this.per_page,
      };
      this.search360();
    },
    clear() {
      this.company = "";
      this.yearid = "";
      this.capital_id = "";
      this.financ_id = "";
      this.industry = "";
      this.public_id = "";
      this.scale_range = "";
      this.status = "";
      this.entypeid = "";
      this.area = [];
      this.qualificat = "";
    },
    //分页
    async handleSizeChange(val) {
      this.loading = true;
      this.per_page = val;
      this.selectOptions.per_page = val;
      this.search360();
    },
    async handleCurrentChange(val) {
      this.loading = true;
      this.page = val;
      this.selectOptions.page = val;
      this.search360();
    },
    goEnterprise(id) {
      this.$router.push({
        name: "enterprise",
        params: { id, activeMenu: "portrait", type: "qg" },
      });
    },
  },
};
</script>

<style lang="less" scoped>
/deep/
  .el-table--striped
  .el-table__body
  tr.el-table__row--striped.el-table__row--striped.el-table__row--striped
  td {
  background: #f7faff;
}
.el-table {
  .el-table__body-wrapper {
    height: calc(100% - 48px) !important; // 表格高度减去表头的高度
  }
}
.content {
  margin: 0 auto;
  width: 1440px;
  overflow: hidden;
  text-align: left;
}
.bgc {
  height: 240px;
  background: url("~@img/portrait/bg-360.png") no-repeat center;
  background-size: 100% 300px;
}
.ep-name {
  margin: 35px auto;
  width: 1000px;
  position: relative;
}
.search_icon {
  position: absolute;
  left: 30px;
  top: 15px;
  z-index: 9;
  cursor: default;
}
.search_input {
  position: absolute;
  right: 0;
  top: 0;
  width: 150px;
  height: 60px;
  line-height: 60px;
  font-size: 24px;
  font-weight: bold;
  color: #ffffff;
  background: #446db3;
  text-align: center;
  cursor: default;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}
/deep/ .ep-name .el-input {
  width: 1000px;
  height: 60px;
  line-height: 60px;
}
/deep/ .ep-name .el-input__inner {
  padding: 0 150px 0 80px;
  height: 60px;
  background: #fff;
  // border: 1px solid #fff;
  border-radius: 10px;
  color: #333;
  font-size: 20px;
}
/deep/ input::-webkit-input-placeholder {
  color: #333;
  font-family: Microsoft YaHei;
  font-weight: 400;
}
/deep/ input::-moz-input-placeholder {
  color: #333;
  font-family: Microsoft YaHei;
  font-weight: 400;
}
/deep/ input::-ms-input-placeholder {
  color: #333;
  font-family: Microsoft YaHei;
  font-weight: 400;
}

.table_box_padding {
  padding: 0px 30px;
}
.portrait_body {
  height: 100%;
  background: #f5f5f5;
}
.portrait_main {
  margin: 0 auto;
  width: 100%;
  height: calc(100% - 240px);
  background: #fff;
}
.option {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  li {
    flex: 0 0 24%;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #333333;
    margin-bottom: 20px;
    label {
      color: rgba(255, 255, 255, 0.8);
      line-height: 32px;
    }
    &:last-of-type {
      justify-content: start;
    }
  }
}
.size {
  margin: 4px 0;
  height: 60px;
  line-height: 60px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #333333;
  cursor: default;
}
// 修改输入框
/deep/ .option .el-input {
  width: 250px;
  height: 32px;
  line-height: 32px;
}

/deep/ .option .el-input__inner {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e0e0e2;
  border-radius: 5px;
  height: 32px;
  line-height: 32px;
  color: #333;
}
// 修改选择框
/deep/ .option .el-input__icon {
  line-height: 32px;
}
//
/deep/ .option .el-icon-arrow-up:before {
  display: inline-block;
  width: 14px;
  height: 8px;
  content: "";
  background: url("~@img/portrait/icon-select-down.png") no-repeat center;
}
/deep/ .option .el-icon-arrow-down:before {
  display: inline-block;
  width: 14px;
  height: 8px;
  content: "";
  background: url("~@img/portrait/icon-select-down.png") no-repeat center;
}
/deep/ .option .el-select .el-input .el-select__caret {
  transform: rotateZ(0);
  -moz-transform: rotateZ(0);
  -webkit-transform: rotateZ(0);
  -o-transform: rotateZ(0);
}
/deep/ .option .el-select .el-input .el-select__caret.is-reverse {
  transform: rotateZ(180deg);
  -moz-transform: rotateZ(180deg);
  -webkit-transform: rotateZ(180deg);
  -o-transform: rotateZ(180deg);
}
// 修改按钮
/deep/ .option .el-button {
  width: 100px;
  height: 32px;
  line-height: 8px;
  text-align: center;
  border-radius: 4px;
}
/deep/ .option .el-button:first-of-type {
  background: #446db3;
  color: #fff;
  border: none;
}
/deep/ .option .el-button:last-of-type {
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid #ffffff;
  border-radius: 4px;
  color: #ffffff;
}
// 选项卡样式修改
/deep/.el-tabs__item {
  padding: 0 50px;
  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #333333;
  height: 60px;
  line-height: 60px;
}
/deep/.el-tabs__item.is-active {
  font-weight: bold;
  color: #446db3;
}

/deep/.el-tabs__active-bar {
  height: 4px;
  background: #446db3;
}
/deep/ .el-tabs__nav-wrap {
  box-shadow: 0px 2px 6px 0px rgba(4, 0, 0, 0.1);
}
/deep/ .el-tabs__nav-wrap::after {
  height: 0;
}
/deep/.el-tabs__header {
  margin: 0;
}
/deep/.el-tabs {
  height: 100%;
  .el-tabs__content {
    box-sizing: border-box;
    height: calc(100% - 60px);
    // padding: 30px 30px 20px;
    overflow: unset;
  }
}
/deep/.el-tabs__nav-scroll {
  padding-left: 30px;
}

//// 表格样式修改
/deep/.el-table--striped
  .el-table__body
  tr.el-table__row--striped
  td.el-table__cell {
  background: #f7faff;
}

/deep/.el-table__header .has-gutter tr th {
  height: 48px;
  background: #5889dc;
  color: #fff;
  border-right: 0;
}
/deep/.el-table tr {
  height: 48px;
  font-size: 14px;
  background-color: #fff;
}
/deep/.el-table .el-table__cell {
  height: 48px;
  padding: 0;

  .cell {
    height: 48px;
    line-height: 48px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

// 表格分页样式修改
.el-pagination {
  text-align: right;
  margin-top: 20px;
}
/deep/ .el-pager li {
  min-width: 30px;
  height: 30px;
  line-height: 30px;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #666666;
  background: #fafafa;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
  margin: 0 8px;
}

/deep/ .el-pager li.active {
  color: #fff;
  background: #5889dc;
  box-shadow: 0px 0px 3px 0px rgba(0, 50, 89, 0.4);
  border-radius: 6px;
}

/deep/ .el-pagination .el-icon-arrow-right:before {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  background: url("~@img/atlas/icon-page-right.png") no-repeat center;
}
/deep/
  .el-pagination
  button:disabled.btn-next:hover
  .el-icon-arrow-right:before {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  background: url("~@img/atlas/icon-page-right.png") no-repeat center;
}
/deep/.el-pagination .btn-next:hover .el-icon-arrow-right:before {
  background: url("~@img/atlas/sidenav-hover2.png") no-repeat center;
}
/deep/ .el-pagination .el-icon-arrow-left:before {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  background: url("~@img/atlas/icon-page-left.png") no-repeat center;
}
/deep/
  .el-pagination
  button:disabled.btn-prev:hover
  .el-icon-arrow-left:before {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  background: url("~@img/atlas/icon-page-left.png") no-repeat center;
}
/deep/.el-pagination .btn-prev:hover .el-icon-arrow-left:before {
  background: url("~@img/atlas/sidenav-hover1.png") no-repeat center;
}
/deep/.pagination .el-select .el-input.is-focus .el-input__inner {
  height: 30px;
  border-color: #fafafa;
  background: #fafafa;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
}
/deep/.pagination .el-input__inner {
  height: 30px;
  color: #666;
  border-color: #fafafa;
  background: #fafafa;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
}
/deep/.pagination .el-pagination__sizes .el-input .el-input__inner:hover {
  height: 30px;
  border-color: #fafafa;
  background: #fafafa;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
}
/deep/ .el-pagination__jump {
  height: 30px;
  line-height: 30px;
}
/deep/.pagination .el-pagination__jump .el-input__inner {
  color: #ccc;
}
/deep/.pagination .el-pagination__jump .el-input__inner.active {
  color: #666;
}
/deep/.el-pagination__jump .el-input__inner:focus {
  color: #666;
}

/*
  *常用电脑尺寸  1680 * 900
  *              1536 * 864
  *              1440 * 900
  *ipad pro      1366 * 1024
  *ipad mini     1024 * 768
  *ipad          1024 * 768
 */
/*分辨率低于1680，采用下面的样式*/
@media screen and (max-device-width: 1680px) {
}
/*分辨率低于1536，采用下面的样式*/
@media screen and (max-device-width: 1536px) {
  /deep/ .el-table--border {
    height: 294px !important;
  }
}
/*分辨率低于1440，采用下面的样式*/
@media screen and (max-device-width: 1440px) {
  .content {
    width: 1240px;
  }
  /deep/ .option .el-input {
    width: 200px;
  }
  /deep/ .el-table--border {
    height: 394px !important;
  }
}
/*分辨率低于1366，采用下面的样式*/
@media screen and (max-device-width: 1366px) {
  .content {
    width: 1240px;
  }
  /deep/ .option .el-input {
    width: 200px;
  }
  /deep/ .el-table--border {
    height: 394px !important;
  }
}
/*分辨率低于1180，采用下面的样式*/
@media screen and (max-device-width: 1180px) {
  .content {
    width: 1000px;
  }
  /deep/ .option .el-input {
    width: 160px;
  }
  /deep/ .el-table--border {
    height: 293px !important;
  }
}
/*分辨率低于1024，采用下面的样式*/
@media screen and (max-device-width: 1024px) {
  .content {
    width: 1000px;
  }
  /deep/ .option .el-input {
    width: 160px;
  }
  /deep/ .el-table--border {
    height: 246px !important;
  }
}
/deep/ .el-table .el-table__body-wrapper .el-table__cell .cell,
/deep/ .el-table .el-table__fixed-body-wrapper .el-table__cell .cell {
  cursor: default !important;
}
</style>
